# @Version : 1.0
# @Author  : wxz
# @File    : chat_router.py
# @Time    : 2025/6/18 23:03
# @Describe: 描述...
from fastapi import APIRouter, Depends
from starlette.requests import Request

from apps.chat.schemas.chat_message_dto import ChatMessageDto
from apps.chat.service.chat_service import ChatService
from commons.result import Result

chats = APIRouter()

@chats.post('/chat-messages', response_model=Result, summary="简单聊天对话")
async def chat_messages(message: ChatMessageDto,
                        request: Request,
                        chat_service: ChatService = Depends(),
                        ):
    # 获取用户ID
    user_id = request.state.user_id

    response = await chat_service.chat_messages(message, user_id)

    return Result(data=response)
